package com.woniuxy;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目启动类
 */
@RestController
@SpringBootApplication
@MapperScan("com.woniuxy.mapper")
public class PawnShopApplication {
    @RequestMapping
    public String hello() {
        return "Hello Spring Boot!";
    }

    // 最新版分页插件
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor pa = new PaginationInnerInterceptor(DbType.MYSQL);
        pa.setOverflow(true);
        interceptor.addInnerInterceptor(pa);
        return interceptor;
    }
    public static void main(String[] args) {
        SpringApplication.run(PawnShopApplication.class, args);
    }

}
